package com.homework.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.homework.anno.AopAnnoadd;
import com.homework.anno.AopAnnoupdate;
import com.homework.mapper.UserMapper;
import com.homework.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService{
    @Autowired

    private UserMapper mapper;
    @Override
    @AopAnnoadd
    public int adduser(User user) {
        return mapper.insert(user);
    }


    @Override
    public boolean login(QueryWrapper wapper) {
        return mapper.selectList(wapper).isEmpty();
    }

    @Override
    @AopAnnoupdate
    public int update(User user, QueryWrapper wapper) {
        return mapper.update(user, wapper);
    }

    @Override
    public int delete(QueryWrapper wapper) {
        return mapper.delete(wapper);
    }
}
